﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TasksModel
{
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://mp.tasks.com/2010/")]
    public class TaskStatus : NamedObject
    {
        #region Properties

        private string _description;

        public string Description
        {
            [System.Diagnostics.DebuggerStepThrough]
            get { return _description; }
            set
            {
                if (!object.ReferenceEquals(_description, value))
                {
                    _description = value;
                    NotifyPropertyChanged("Description");
                }
            }
        }

        private bool _isInitialStatus;

        /// <summary>
        /// Should not be changed.
        /// </summary>
        public bool IsInitialStatus
        {
            [System.Diagnostics.DebuggerStepThrough]
            get { return _isInitialStatus; }
            set
            {
                if (!object.ReferenceEquals(_description, value))
                {
                    _isInitialStatus = value;
                    NotifyPropertyChanged("IsInitialStatus");
                }
            }
        }

        private bool _isFinalStatus;

        /// <summary>
        /// Should not be changed.
        /// </summary>
        public bool IsFinalStatus
        {
            [System.Diagnostics.DebuggerStepThrough]
            get { return _isFinalStatus; }
            set
            {
                if (!object.ReferenceEquals(_description, value))
                {
                    _isFinalStatus = value;
                    NotifyPropertyChanged("IsFinalStatus");
                }
            }
        }

        public string UriSchema
        {
            [System.Diagnostics.DebuggerStepThrough]
            get { return BaseSchema + "status"; }
        }

        #endregion

        #region Constructors

        public TaskStatus(Guid id)
        {
            ID = id;
        }

        public TaskStatus()
            : this(Guid.NewGuid())
        {
        }

        /// <summary>
        /// Deep copy. Does not copy events.
        /// </summary>
        /// <param name="ts"></param>
        public TaskStatus(TaskStatus ts)
            : this(ts.ID)
        {
            _description = ts._description;
            Name = ts.Name;
            Timestamp = ts.Timestamp;
        }

        #endregion
    }
}